/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package swingDemoEvent;

import java.awt.*;
import java.awt.event.*;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JTextField;
public class ActionEventTest extends JFrame {
    JTextField t1 = new JTextField("abc");
    JButton b1 = new JButton("change");
    JButton b2 = new JButton("exit");
    public ActionEventTest() {
        setLayout(new FlowLayout());
        //ActionEvent e2
        b1.addActionListener(new b1L());
        b2.addActionListener(new b2L());
        setSize(200, 200);
        setVisible(true);
        add(b1);
        add(b2);
        add(t1);
    }

    public class b1L implements ActionListener {

        public void actionPerformed(ActionEvent e) {
            b1.setText(" pressed");
            t1.setText("dddd");
        }
    }
    public class b2L implements ActionListener {

        public void actionPerformed(ActionEvent e) {
            System.exit(0);
        }
    }
    public static void main(String[] args) {
        ActionEventTest ic = new ActionEventTest();
    }
}
